#include "CAction.h"

CML_NAMESPACE_USE();






CAction::CAction( void )
{
	next = this;
	sa = 0;
}

CAction::CAction( CSeaAmp &seaAmp, int id )
{
	next = this;
	sa = 0;
	Init( seaAmp, id );
}

CAction::~CAction( void )
{
	UnInit();
}

bool CAction::Init( CSeaAmp &seaAmp, int id )
{
	DisableAction();

	this->id = id;
	sa = &seaAmp;
	return 0;
}

bool CAction::UnInit()
{
	DisableAction();
	sa = 0;
	return 0;
}

void CAction::DoAct( void )
{
	return;
}

int CAction::getActionID( void )
{
	return id;
}

bool CAction::EnableAction( void )
{
	if( !sa ) return 1;

	return sa->EnableAction( this );
}

bool CAction::DisableAction( void )
{
	if( !sa ) return 1;

	if( next == this ) return 1;

	return sa->DisableAction( this );
}